package com.plian.system.wrapper.fr.audit;

import com.plian.system.dto.fr.audit.AuditSystemDTO;
import com.plian.system.entity.fr.audit.AuditSystem;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.fr.audit.AuditSystemVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.SPRING;
import static com.plian.system.wrapper.util.WrapperConstant.USER_ID_TO_NAME;

/**
 * 审计制度包装类,返回视图层所需的字段
 *
 * @author gangan
 * @since 2019-09-27
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface AuditSystemWrapper extends BaseWrapper<AuditSystem, AuditSystemDTO, AuditSystemVO> {

    @Override
    @Mappings(value = {
            @Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME)
    })
    AuditSystemVO entityToVO(AuditSystem entity);

}
